package com.fitns.user.conf;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.github.pagehelper.PageHelper;

public class Model  {
	private static final Integer DEFAULT_SIZE=10;
	//查询时用到搜索字�?
	protected Integer pageNum;
	protected Integer pageSize;
	protected boolean isPage = true;//是否分页
    
    /**
     * 分页操作
     * Mar 26, 2018 2:44:41 PM
     * lsb
     */
    public void pageHandle() {
    	if(isPage) {
    		int pageNumView =getPageNum();
    		int pageSizeView =getPageSize();
    	    PageHelper.startPage(pageNumView, pageSizeView);
    	}
    }
	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,ToStringStyle.SHORT_PREFIX_STYLE);
	}
	public Integer getPageNum() {
		return pageNum==null?1:pageNum==0?1:pageNum;
	}
	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}
	public Integer getPageSize() {
		return pageSize==null?DEFAULT_SIZE:pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public boolean isPage() {
		return isPage;
	}
	public void setPage(boolean isPage) {
		this.isPage = isPage;
	}
	
	
	
}